#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
   const QString& s = ui->lineEdit->text();
   ui->listWidget->addItem(s);
}

void Widget::on_pushButton_delete_clicked()
{
    int row = ui->listWidget->currentRow();
    if(row<0)
        return;
    ui->listWidget->takeItem(row);
}
